import React, {Component, Fragment, lazy} from 'react';
import {Switch, Route, Redirect} from 'react-router-dom';

const Index = lazy(() => import('../components/Product/Index'));
const Save = lazy(() => import('../components/Product/Save'));

class Product extends Component {
	render() {
		return (
			<Fragment>
				<Switch>
					<Route path="/product/index" component={Index}/>
					<Route path="/product/save" exact component={Save}/>
					<Route path="/product/save/:id" component={Save}/>
					<Route path="/product/detail/:id" component={Save}/>
					<Redirect from="/product" to="/product/index"/>
				</Switch>
			</Fragment>
		);
	}
}

export default Product;